package com.bella.api.configuration;

import com.bella.api.filter.AuthWebInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class MvcConfigurer extends WebMvcConfigurerAdapter {

  @Bean
  public AuthWebInterceptor authWebInterceptorTemp() {
    return new AuthWebInterceptor();
  }

  @Override
  public void addInterceptors(InterceptorRegistry registry) {
    registry.addInterceptor(authWebInterceptorTemp()).addPathPatterns("/web/v1/**").excludePathPatterns("/web/common/login");
    super.addInterceptors(registry);
  }
}
